package com.dzsw.javabase.file;

import cn.hutool.core.io.FileUtil;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class CopySample {
    private static List<String> list = new ArrayList<String>();

    static {
        list.add("\\toss_asahiint\\Source\\config\\rules\\toss.tsd.tsd240.tsd240listform.xml");
        list.add("\\toss_asahiint\\Source\\config\\properties\\dataselect.properties");
        list.add("\\toss_asahiint\\Source\\config\\report\\jasper\\ProformaInvoice_en.jasper");
        list.add("\\toss_asahiint\\Source\\config\\report\\jasper\\ProformaInvoice_ja.jasper");
        list.add("\\toss_asahiint\\Source\\config\\report\\jasper\\Invoice_en.jasper");
        list.add("\\toss_asahiint\\Source\\config\\report\\jasper\\Invoice_ja.jasper");
        list.add("\\toss_asahiint\\Source\\config\\report\\jasper\\PackingList_en.jasper");
        list.add("\\toss_asahiint\\Source\\config\\report\\jasper\\PackingList_ja.jasper");
        list.add("\\toss_asahiint\\Source\\config\\report\\xml\\ProformaInvoice_en.xml");
        list.add("\\toss_asahiint\\Source\\config\\report\\xml\\ProformaInvoice_ja.xml");
        list.add("\\toss_asahiint\\Source\\config\\report\\xml\\Invoice_en.xml");
        list.add("\\toss_asahiint\\Source\\config\\report\\xml\\Invoice_ja.xml");
        list.add("\\toss_asahiint\\Source\\config\\report\\xml\\PackingList_en.xml");
        list.add("\\toss_asahiint\\Source\\config\\report\\xml\\PackingList_ja.xml");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO520_en.xls");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO520_en.xlsx");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO520_ja.xls");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO520_ja.xlsx");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\Tss130_en.xls");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\Tss130_en.xlsx");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\Tss130_ja.xls");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\Tss130_ja.xlsx");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO530_en.xls");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO530_en.xlsx");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO530_ja.xls");
        list.add("\\toss_asahiint\\Source\\config\\report\\excelTemple\\TSO530_ja.xlsx");
        list.add("\\toss_asahiint\\Source\\src\\ApplicationResources.properties");
        list.add("\\toss_asahiint\\Source\\src\\ApplicationResources_en.properties");
        list.add("\\toss_asahiint\\Source\\src\\ApplicationResources_ja.properties");
        list.add("\\toss_asahiint\\Source\\src\\ApplicationResources_zh.properties");
        list.add("\\toss_asahiint\\Source\\src\\softowner.properties");
        list.add("\\toss_asahiint\\Source\\src\\toss\\common\\basic\\ReportMappingConstants.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\common\\struts\\ReportCommonAction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\common\\report\\StampDataBean.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsi\\tsi140\\tsi140action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsm\\tsm190\\tsm190action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsm\\tsm190\\tsm190entryform.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd110\\tsd110action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd110\\tsd110detailaction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd110\\tsd110reportaction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd140\\tsd140action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd140\\tsd140detailaction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd140\\tsd140reportaction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd150\\tsd150action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd150\\tsd150detailaction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd150\\tsd150reportaction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tso\\tso520\\Tso520ExcelPrintAction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tss\\tss130\\Tss130ExcelPrintAction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tso\\tso530\\Tso530ExcelPrintAction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd240\\tsd240action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd240\\tsd240entryform.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd240\\tsd240listdata.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd240\\tsd240listform.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tso\\tso860\\tso860ExcelAction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tso\\tso860\\tso860excelForm.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsn\\tsn190\\tsn190action.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsn\\tsn190\\tsn190listform.java");
        list.add("\\toss_asahiint\\Source\\toss\\common\\css\\sign.css");
        list.add("\\toss_asahiint\\Source\\toss\\common\\js\\common.js");
        list.add("\\toss_asahiint\\Source\\toss\\common\\jsp\\popup.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\common\\images\\default_stamp.png");
        list.add("\\toss_asahiint\\Source\\toss\\tsd\\dataForm\\tsd110DataForm.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsd\\tsd110\\tsd110detail.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsd\\tsd140\\tsd140detail.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsd\\tsd150\\tsd150detail.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsd\\tsd240\\tsd240condition.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsd\\tsd240\\tsd240list.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsn\\tsn190\\tsn190condition.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsn\\tsn190\\tsn190frame.jsp");
        list.add("\\toss_asahiint\\Source\\toss\\tsm\\tsm190\\tsm190entry.jsp");
        list.add("\\toss_asahiint\\Source\\src\\toss\\common\\copy\\CopyDetailAction.java");
        list.add("\\toss_asahiint\\Source\\src\\toss\\tsd\\tsd150\\tsd150copyaction.java");
    }

    public static void main(String[] args) {
        System.out.println("File count: " + list.size());
        copyFile();
    }

    private static void copyFile() {
        System.out.println(" ------ copy file start ------ ");
        String basePath = "D:\\works\\gitbucket";
        String targetPath = "D:\\works\\temp";
        int count = 0;
        for (String str : list) {
            // find path
            int num = str.lastIndexOf("\\");
            File dir = new File(targetPath + str.substring(0, num));
            if (!dir.exists()) {
                dir.mkdirs();
            }
            File file = new File(basePath + str);
            if (file.exists()) {
                FileUtil.copy(basePath + str, targetPath + str, true);
                System.out.println(targetPath + str);
            }
            count++;
        }
        System.out.println(" ------ copy file success!, total file count [" + count + "] ------ ");
    }
}
